

<script>
    $(function(){
        $('#add_boton').click(function(){
        
        
            var x=$('#txt1').attr('value');
            var y= $('#areatxt').attr('value');
        
            x=x.toUpperCase(x);
            if(y!=""){
                y=y+'\n'+x;
            }else{
                y=x;
            }
        
            $('#areatxt').attr('value',y)
            $('#txt1').attr('value','')
        });
        $('#botonback').click(function(){
            var tx=$('#areatxt').attr('value');
            lineas=tx.split('\n');
            lineas.pop();
            tx=lineas.join('\n');
            $('#areatxt').attr('value',tx);
        });
         $("input,textarea").keyup(function(){
                    if($(this).attr('id')!='usr'){
                        $(this).val($(this).val().toUpperCase());
                    }


                });
    })
</script>


<fieldset>
    <table >

        <tbody>
            <tr>
                <td><?php echo $this->Form->textarea('', array('class' => 'txtarea','label' => 'Documento', 'id' => 'txt1')); ?></td>

                <td><?php echo $this->Form->button('Adicionar', array('type' => 'button', 'id' => 'add_boton')); ?></td>
            </tr>
        </tbody>
    </table>
    <?php echo $form->create('Appraisal') ?>
    <table >

        <tbody>
            <tr>
                <td><?php echo $this->Form->input('Appraisal.antecedentes', array('class' => 'txtarea', 'label' => 'Análisis de antecedentes', 'readonly' => 'readonly', 'id' => 'areatxt')); ?></td>

                <td><?php echo $this->Form->button('Eliminar', array('type' => 'button', 'id' => 'botonback')); ?></td>
            </tr>
        </tbody>
    </table>
    <?php echo $form->input('Appraisal.id'); ?>
    <?php if($this->data['Appraisal']['bloqueo']=="No")
    
    echo $ajax->submit('Guardar', array('url' => array('controller' => 'Appraisals', 'action' => 'backgrounds', $this->data['Appraisal']['id']), 'update' => 'antecedentes', 'complete' => 'mayusculas()', 'indicator' => 'loadbacks'));
    echo $form->end();
    ?>
    <div id="loadbacks" style="display: none;">
        <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
    </div>
    <?php echo $this->Session->flash(); ?>
</fieldset>
<?php echo $ajax->link($html->image("regresar.gif", array('width' => '30', 'heigth' => '30', 'alt' => 'regresar', 'align' => 'center')), array('controller' => 'Appraisals', "action" => "backgrounds_index",$this->data['Appraisal']['id']), array('escape' => false, 'update' => 'antecedentes', 'complete' => '', 'indicator' => 'loadbacks')); ?>


